<?php
include_once('admin-load.php');
$consignee_id = isset($_REQUEST['consignee_id']) ? $_REQUEST['consignee_id'] : null;
$consignee = '';
if ($consignee_id) {
    $query = "SELECT * FROM consignee WHERE id = $consignee_id ";
    $consignee = $dbna->get_row($query);
}

if (isset($_POST['submit_form'])) {
    update_consignee();
}
?> 
<?php
include_once 'header.php';
?>
<div id="main_content">
    <div id="content">

    </div>
    <div class="container">
        <h5>Edit New Consignee</h5>

    </div>
    <div id="main">
        <h2>Edit New Consignee</h2>
        <form id="add_user" action="consignee-edit.php" method="post">
            <input type="hidden" value="<?php echo $consignee_id ?>" name="consignee_id"/>
            <input type="hidden" value="1" name="submit_form"/>
            <fieldset>
                <legend>Consignee</legend>
                <div>
                    <label for="receive_name">Receive Name : </label>
                    <input type="text" id="receive_name" name="receive_name" value="<?php echo $consignee->receive_name ?>"/>
                </div>
                <div>
                    <label for="phone">Phone : </label>
                    <input type="text" id="phone" name="phone" value="<?php echo $consignee->phone ?>"/>
                </div>
                <div>
                    <label for="fax">Fax : </label>
                    <input type="text" id="fax" name="fax" value="<?php echo $consignee->fax ?>"/>
                </div>
                <div>
                    <label for="country">Country : </label>
                    <?php echo countrySelect ($consignee->country) ?>
                          
                </div>
                <div>
                    <label for="zip">Zip : </label>
                    <input type="text" id="zip" name="zip" value="<?php echo $consignee->zip ?>"/>
                </div>
                <div class="buttons">
                    <input type="submit" value="update" name="submit"/>   
                </div>
        </form>

    </div>

    <?php
    include_once 'footer.php';
    ?>